﻿using System;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using nwrole.lib;
using System.Collections.Generic;

namespace nwrole.PluginService {
    public partial class PluginService : ServiceBase {

        private PluginServiceHost pluginServiceHost;

        private ConsoleLogWriter consoleLogWriter = new ConsoleLogWriter();

        public PluginService(string pluginProviderClassName, Guid id, string serviceName, int port, int supervisorPort) {
            pluginServiceHost = new PluginServiceHost(pluginProviderClassName, id, serviceName, port, supervisorPort);

            InitializeComponent();

            Console.SetOut(consoleLogWriter);
        }

        protected override void OnStart(string[] args) {
            pluginServiceHost.Start();
        }

        protected override void OnStop() {
            pluginServiceHost.Stop();
        }
    }
}
